import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BizStationEnergySummaryVo, StationEnergyQuery, StationEnergyRecord } from './types';

/**
 * 查询站房用电量汇总信息列表
 * @param query
 * @returns {*}
 */

export const listEnergySummary = (query?: StationEnergyQuery): AxiosPromise<BizStationEnergySummaryVo[]> => {
  return request({
    url: '/biz-station/station/energy/summary/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询站房用电量汇总信息详细
 * @param id
 */
export const getEnergySummary = (id: string | number): AxiosPromise<BizStationEnergySummaryVo> => {
  return request({
    url: '/biz-station/station/energy/summary/' + id,
    method: 'get'
  });
};

/**
 * 新增站房电量登记
 * @param query
 * @returns {*}
 */
export const addEnergyRecord = (data?: StationEnergyRecord) => {
  return request({
    url: '/biz-station/station/energy/record',
    method: 'post',
    data: data
  });
};

/**
 * 修改站房电量登记
 * @param query
 * @returns {*}
 */
export const editEnergyRecord = (data?: StationEnergyRecord) => {
  return request({
    url: '/biz-station/station/energy/record',
    method: 'put',
    data: data
  });
};


/**
 * 查询站房电量登记列表
 * @param query
 * @returns {*}
 */

export const listEnergyRecord = (query?: StationEnergyQuery): AxiosPromise<StationEnergyRecord[]> => {
  return request({
    url: '/biz-station/station/energy/record/list/settle',
    method: 'get',
    params: query
  });
};

/**
 * 删除站房电量登记
 * @param id
 */
export const delEnergyRecord = (id: string | number | Array<string | number>) => {
  return request({
    url: '/biz-station/station/energy/record/' + id,
    method: 'delete'
  });
};